package person.twj.jwt.core.security.util;

import lombok.experimental.FieldNameConstants;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

//@Getter
//@Setter
//@Builder
@FieldNameConstants
public class UserToken extends User {
    protected Long userId;
    protected String username;
    protected String password;
    protected Long exp;// 有效时间
    protected Collection<GrantedAuthority> authorities;

    public UserToken(Long userId,String username, String password, Collection<GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.authorities = authorities;
    }




    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setExp(Long exp) {
        this.exp = exp;
    }

    public void setAuthorities(Collection<GrantedAuthority> authorities) {
        this.authorities = authorities;
    }

    public Long getUserId() {
        return userId;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public String getPassword() {
        return password;
    }

    public Long getExp() {
        return exp;
    }

    @Override
    public Collection<GrantedAuthority> getAuthorities() {
        return authorities;
    }
}
